package org.csu.demopetstore.Controller;

import org.csu.demopetstore.Service.CategortService;
import org.csu.demopetstore.entity.Account;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/main")
public class MainController {

    @Autowired
    private CategortService categortService;

    @RequestMapping("/enter")
    public String enterMain(Model model, HttpSession session){
        Account account = (Account) session.getAttribute("account");
        if (account != null){
            model.addAttribute(account);
        }
        return "catalog/main";
    }

    @RequestMapping("/JPetStoreDemo")
    public String enterJPetStoreDemo(){
        return "common/JPetStoreDemo";
    }
}
